home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
001-025
/
scopedisk1
/
dnet
/
doc
/
dnetlib.doc
next >
Wrap
Text File
|
1995-03-18
|
4KB
|
128 lines
DNET LINK LIBRARY
Link with your server's and client programs.
SERVER CALLS
listenport = DListen(port#)
chanport = DAccept(listenport)
DNAAccept(listenport)
DPri(chanport, priority) (not implemented yet)
act = DNRead(chanport, buf, bytes) (see below)
act = DRead(chanport, buf, bytes) (see below)
act = DWrite(chanport, buf, bytes)
DClose(chanport)
DUnListen(listenport)
DQuit() cause remote end to quit
APPLICATION CALLS
chanport = DOpen(host, port#, priority)
act = DNRead(chanport, buf, bytes) (see below)
act = DRead(chanport, buf, bytes) (see below)
act = DWrite(chanport, buf, bytes)
DEof(chanport)
DClose(chanport)
General notes:
The calls are self-contained in that you can spawn off a task
when you've determined that an a connection is pending. The
spawned task must do the actual DNAccept() call, however, and
you cannot share file descriptors. Only the original task that
did the listen can WaitPort() on the listen port.
The calls are not extremely efficient at the momement, but since
the network, by virtue of being on a serial line, is so slow,
it doesn't really matter.
DEOF()
Eof a channel. Implemented ONLY for the Amiga. You cannot EOF
a channel if running between the Amiga and a UNIX machine. This
is essentially an unsupported call, and you should use DCLose()
to close(and send an eof) on a channel. The network handles it
just fine, but the UNIX side has no way of sending an EOF over
a socket without closing the socket.
DLISTEN()
This call listens on a virtual port # (0-65535) for connections
from a remote host. NULL is returned if the port is already
being listened on by somebody else.
DACCEPT()
Accepts connections over a virtual port #. Several connections
may be accepted and worked on simultaniously. NULL is returned if
there are no pending connections. You can WaitPort() on the
listenport to wait for new connections.
DNAACCEPT()
Don't accept connections over a virtual port #. If there is a
connection pending, it will return an error on the other end.
DUNLISTEN()
Stop listening on a virtual port #. Any pending requests
DPRI()
Set the priority of a channel (-128 lowest to 127 highest).
The priority only effects throughput when two or more channels
at different priorities are transfering data at the same time.
Not currently implemented.. priority is what you set in DOpen()
DNREAD()
Read data from a channel. 0 is a valid return value, meaning that
no data is currently ready to read. You can WaitPort() on the
channel port to wait for data (or EOF). A negative value is
returned on EOF or failure.
error codes:
-1 EOF on channel
-2 Remote end CLOSED the channel (not implemented)
DREAD()
Read data from a channel. The number of bytes requested are
returned, unless the other end closed it's side in which case
fewer than the number of bytes requested will be returned. That
is, this call will BLOCK waiting for data.
A negative value is returned on EOF or failure.
DWRITE()
Write data to a channel. The return value is either the # bytes
written, or a negative error code.
-1 Remote end REOF'd the channel
-2 Remote end CLOSED the channel
note: not much distinction between the two
currently.
DCLOSE()
Close a channel.
DOPEN()
Application side OPEN().... Open a port# on a remote host. Returns
a channel port or NULL. The priority is from -127 (lowest) to
126 (highest).